<?php echo $this->fetch('top.html'); ?>
<script type="text/javascript" src="<?php echo $this->lib_base . "/" . 'mobile/search_goods.js'; ?>" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
	$("img.lazyload").lazyLoad();
	var order = '<?php echo $_GET['order']; ?>';
	var	order_arr = order.split(' ');
	$('#'+order_arr[0]).addClass('current');
	var type = order_arr[0];
	var char;
	switch(type)
	{
		case 'price':
		char = '价格';
		break;
		case 'sales':
		char = '销量';
		break;
		case 'add_time':
		char = '新品';
		break;
	}
	if(type !=="") $('#'+order_arr[0]+' span').html(order_arr[1]=="desc" ? char+"↓" : char+"↑" );
	$(".display-order li").click(function(){
		if(this.id==''){
			dropParam('order');// default order
			return false;
		}
		else
		{
			dd = " desc";
			if(order != '') {
				if(order_arr[0]==this.id && order_arr[1]=="desc")
					dd = " asc";
				else dd = " desc";
			}
			replaceParam('order', this.id+dd);
			return false;
		}
	});
});
function submitForm()
{
	replaceParam('keyword',$('[name="keyword"]').val());
	return false;
}
</script>
<div id="main">
		
		<div class="bar-wrap">
			<div style="line-height:30px;" class="top-bar">
        	<a href="javascript:pageBack();" class="pageback"><span></span></a>
            <div class="store-search">
			<form id="search-form">
				<input name="keyword"  type="text" class="kw border-0" placeholder="当前条件下搜索"/>
				<p><a href="javascript:;" onclick="submitForm();" class="submit"></a></p>
			</form>
		</div>
            <a href="javascript:;" class="pagemore J_pagemore"><span></span></a>
        </div>
        <div class="eject-tab J_eject_tab w-full clearfix hidden"> <a href="index.php"> <span></span>
				<p>首页</p>
				</a> <a href="<?php echo url('app=search'); ?>"> <span class="icon2"></span>
				<p>分类搜索</p>
				</a> <a href="<?php echo url('app=cart'); ?>"> <span class="icon3"></span>
				<p>购物车</p>
				</a> <a href="<?php echo url('app=member'); ?>"> <span class="icon4"></span>
				<p>用户中心</p>
				</a> </div>
		</div>
			
	<div id="page-search-goods">
        <div class="search-goods page-body">
        	<?php if ($this->_var['goods_list']): ?>
            <div class="attr">
            	<div class="tit clearfix">
                	<p><span class="active">排序</span><i></i></p>
                    <p class="filter J_filter"><span style="border:0px;">筛选<b></b></span></p>
                </div>
                <div class="cons">
                    <ul class="display-order clearfix">
                        <li <?php if ($_GET['order'] == ''): ?>class="current"<?php endif; ?>><span>综合</span></li>
                        <li id="add_time"><span>新品</span></li>
                        <li id="sales"><span>销量</span></li>
                        <li id="price"><span>价格</span></li>
                    </ul>
                </div>
            </div>
        	<ul class="<?php echo $this->_var['display_mode']; ?> " ectype="current_display_mode">
				<?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');$this->_foreach['fe_goods'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_goods']['total'] > 0):
    foreach ($_from AS $this->_var['goods']):
        $this->_foreach['fe_goods']['iteration']++;
?>
				<li class="clearfix" <?php if (($this->_foreach['fe_goods']['iteration'] == $this->_foreach['fe_goods']['total'])): ?>style="border-bottom:0px;"<?php endif; ?>>
                	<a href="<?php echo url('app=goods&id=' . $this->_var['goods']['goods_id']. ''); ?>">
					<div class="pic"><img src="mobile/static/images/empty.gif"  class="lazyload" initial-url="<?php echo $this->_var['site_url']; ?>/<?php echo $this->_var['goods']['default_image']; ?>" /></div>
					<div class="info">
                    	<h2><?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?></h2>
                        <div class="price mt5"><?php echo price_format($this->_var['goods']['price']); ?></div>
                        <div class="sales mt5">已售<?php echo ($this->_var['goods']['sales'] == '') ? '0' : $this->_var['goods']['sales']; ?> 件 , <a href="<?php echo url('app=goods&act=comments&id=' . $this->_var['goods']['goods_id']. ''); ?>"><?php echo ($this->_var['goods']['comments'] == '') ? '0' : $this->_var['goods']['comments']; ?> 评论</a></div>
                        <div class="store mt5">
                          	<span><?php echo htmlspecialchars($this->_var['goods']['grade_name']); ?></span>
                            <?php echo htmlspecialchars($this->_var['goods']['store_name']); ?>
                        </div>
                    </div>
                    </a>
				</li>
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			</ul>
            <div class="pageinfo pt10 pb10"><?php echo $this->fetch('page.bottom.html'); ?></div>
            <?php else: ?>
            <div class="pb20 pt20 center">很抱歉! 没有找到相关商品</div>
            <?php endif; ?>
        </div>
    </div>
</div>
<div id="pageslide" class="J_masker"></div>
<div id="cate-model" class="J_hide_box">
	<div class="screen-height wrap">
        <?php if ($this->_var['filters']): ?>
        <div class="selected-attr title mb20">
             <strong class="block mt10">您已选择：</strong>
             <?php $_from = $this->_var['filters']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'filter');if (count($_from)):
    foreach ($_from AS $this->_var['filter']):
?>
             <a class="mt10" href="javascript:;" id="<?php echo $this->_var['filter']['key']; ?>"><?php echo $this->_var['filter']['name']; ?>：<?php echo $this->_var['filter']['value']; ?> x</a>
             <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
        </div>
        <?php endif; ?>
        <?php if ($this->_var['categories']): ?>
        <ul class="cates">
            <li class="J_tit tit"><a>商品分类</a></li>
            <li ectype="ul_cate" class="con"> 
                <ul class="list">
                    <?php $_from = $this->_var['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'gcategory');$this->_foreach['fe_gcategory'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_gcategory']['total'] > 0):
    foreach ($_from AS $this->_var['gcategory']):
        $this->_foreach['fe_gcategory']['iteration']++;
?>
                    <li><a id="<?php echo $this->_var['gcategory']['cate_id']; ?>"  href="javascript:void(0);"><?php echo $this->_var['gcategory']['cate_name']; ?>(<?php echo $this->_var['gcategory']['count']; ?>)</a></li>
                    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                </ul>
            </li>
        </ul>
        <?php endif; ?>
        <?php if ($this->_var['brands'] && ! $this->_var['filters']['brand']): ?>
        <ul class="cates">
            <li class="J_tit tit"><a>品牌</a></li>
            <li ectype="ul_brand" class=" con"> 
                <ul class="list">
                    <?php $_from = $this->_var['brands']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'row');$this->_foreach['fe_row'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_row']['total'] > 0):
    foreach ($_from AS $this->_var['row']):
        $this->_foreach['fe_row']['iteration']++;
?>
                    <li><a href="javascript:void(0);" title="<?php echo $this->_var['row']['brand']; ?>" id="<?php echo urlencode($this->_var['row']['brand']); ?>"><?php echo htmlspecialchars($this->_var['row']['brand']); ?>(<?php echo $this->_var['row']['count']; ?>)</a></li>
                    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                </ul>
            </li>
        </ul>
        <?php endif; ?>
        <?php if ($this->_var['price_intervals'] && ! $this->_var['filters']['price']): ?>
        <ul class="cates">
            <li class="J_tit tit"><a>价格</a></li>
            <li ectype="ul_price" class="con"> 
                <ul class="list">
                    <?php $_from = $this->_var['price_intervals']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'row');$this->_foreach['fe_row'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_row']['total'] > 0):
    foreach ($_from AS $this->_var['row']):
        $this->_foreach['fe_row']['iteration']++;
?>
                    <li><a href="javascript:void(0);" id="<?php echo $this->_var['row']['min']; ?> - <?php echo $this->_var['row']['max']; ?>"><?php echo price_format($this->_var['row']['min']); ?> - <?php echo price_format($this->_var['row']['max']); ?>(<?php echo $this->_var['row']['count']; ?>)</a></li>
                    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                </ul>
            </li>
        </ul>
        <?php endif; ?>
        <?php if ($this->_var['regions'] && ! $this->_var['filters']['region_id']): ?>
        <ul class="cates">
            <li class="J_tit tit"><a>所在地区</a></li>
            <li ectype="ul_region" class="con"> 
                <ul class="list">
                    <?php $_from = $this->_var['regions']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'row');$this->_foreach['fe_row'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['fe_row']['total'] > 0):
    foreach ($_from AS $this->_var['row']):
        $this->_foreach['fe_row']['iteration']++;
?>
                    <li><a href="javascript:void(0);"  id="<?php echo $this->_var['row']['region_id']; ?>"><?php echo htmlspecialchars($this->_var['row']['region_name']); ?>(<?php echo $this->_var['row']['count']; ?>)</a></li>
                   <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                </ul>
            </li>
        </ul>
        <?php endif; ?>
        <p class="close"></p>
    </div>
</div>
<script type="text/javascript">
	var closeBtnTop =  window.screen.availHeight/2-50;
	$('#cate-model .close').css('top',closeBtnTop+'px');
	$('#cate-model .close').click(function(){
		closePageSlide();
	});
	$('.J_masker').click(function(){
		closePageSlide();
	});
	$('.J_filter').click(function(){
		$('.J_masker').animate({right:'0'});
		$('.J_hide_box').show().animate({right:'0'},800);;
	});
	$('.J_hide_box .J_tit').click(function(){
		$(this).parent('ul').parent('.wrap').find('.con').hide();
		$(this).next('.con').show();
	})
	function closePageSlide()
	{
		$('.J_masker').animate({right:'-1699px'});
		$('.J_hide_box').animate({right:'-100%'},800).hide();
	}
</script>

<?php echo $this->fetch('footer.html'); ?>
